import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteMockServe } from 'vite-plugin-mock'
import { resolve } from 'path'

export default defineConfig({
    base: './',

    plugins: [
        vue(),
        // 确保mock服务已禁用
        // viteMockServe({
        //     mockPath: './src/mock',
        //     enable: false,
        //     watchFiles: true,
        //     ignore: /^\_/,
        // })
    ],
    resolve: {
        alias: {
            '@': resolve(__dirname, 'src')
        }
    },
    server: {
        port: 5173,
        headers: {
            'Cache-Control': 'no-store',
        },
        proxy: {
            '/api': {
                target: 'https://share.zqp863426526.workers.dev',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ''),
            }
        }
    }
})